Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Objects /
Chapter 7 - View-Related Objects / View-Related Objects Reference
View Port Functions / Creating and Manipulating View Port Objects


GXCopyToViewPort

You can use the GXCopyToViewPort function to create a copy of an existing view port object.

gxViewPort GXCopyToViewPort(gxViewPort target, gxViewPort source);
target
A reference to the view port to copy the source contents into. If you specify nil for this parameter, the GXCopyToViewPort function creates a new view port object.
source
A reference to the view port whose contents you want to copy.
function result
A reference to the copy (that is, the target view port) of the source view port.
DESCRIPTION
The GXCopyToViewPort function copies the contents of an existing view port object to another, or it creates a new view port object and copies the contents of an existing view port object to it. The function copies the clip, mapping, dither, halftone, attributes, and tag list (but not the parent or child view ports) of the view port object specified by the source parameter into the view port object specified by the target parameter. It clones, but does not copy, the tag objects in the tag list. The target view port is placed in the same view group as the source view port. The target view port is not associated with any window, whether or not the source view port is associated with one.

If you specify nil for the target parameter, the GXCopyToViewPort function creates a new view port object and copies the source properties into it.

You can use the GXCopyToViewPort function to create a copy of a view port object and then modify it without changing the original.

SPECIAL CONSIDERATIONS
If you specify nil for the target parameter and no error occurs, the GXCopyToViewPort function creates a view port object; you are responsible for disposing of that object when you no longer need it.

ERRORS, WARNINGS, AND NOTICES
Errors 
out_of_memory 
invalid_viewPort_reference
viewPort_is_a_window(debugging version)
SEE ALSO
For an example of the use of this function, see Listing 7-2 on page 7-44.

To create a new view port that has default values instead of being a copy of an existing view port, use the GXNewViewPort function, described on page 7-70.

To compare two view port objects for equality, use the GXEqualViewPort function, described in the next section.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996